package com.bw.controller;

import com.bw.bean.Vo;
import com.bw.bean.Vo2;
import com.bw.service.VoService;
import com.sugar.SugarUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/**
 * @BelongsProject: dianshangxiangmu_2
 * @BelongsPackage: com.bw.controller
 * @Author: zhangleqing
 * @CreateTime: 2024-10-6  15:05
 * @Description: TODO
 * @Version: 1.0
 */
@RestController
public class VoController {
    @Autowired
    VoService voService;

    @RequestMapping("list1")
    public Map getList1(){
        List<Vo> list=voService.getList1();
        return SugarUtil.getBarData(list);
    }

    @RequestMapping("/list2")
    public Map getList2(){
        List<Vo> list=voService.getList2();
        return SugarUtil.getPieData(list);
    }

    @RequestMapping("/list3")
    public Map getList3(){
        List<Vo> list=voService.getList3();
        return SugarUtil.getPieData(list);
    }

    @RequestMapping("/list4")
    public Map getList4(){
        List<Vo2> list=voService.getList4();
        ArrayList<String> list1 = new ArrayList<>();
        list1.add("品牌");
        list1.add("性别");
        list1.add("总金额");
        return SugarUtil.getTablePlayData(list1,list);
    }
}
